package com.app.controller;

import com.app.model.response.RetStatus;
import com.app.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by cj_so on 2018/5/4.
 */
@RequestMapping(value = "/coin")
@RestController
public class CoinController {

    @Autowired
    private ArticleService articleService;

    @RequestMapping(value = "/article/user")
    public RetStatus getArticleCoin(@RequestBody String parameter){
        RetStatus retStatus = null;
        try{
            retStatus = articleService.getArticleCoin(parameter);
            return retStatus;
        }catch (Exception e){
            return new RetStatus().setCode(200).setMessage(e.getMessage());
        }
    }

    @RequestMapping(value = "/article/user/reward")
    public RetStatus getArticleReward(@RequestBody String parameter){
        try{
            articleService.getArticleReward(parameter);
            return new RetStatus().setCode(100).setMessage("成功");
        }catch (Exception e){
            return new RetStatus().setCode(200).setMessage(e.getMessage());
        }
    }
}
